From fe68fe28126efa44a1050a2eedfc719c23054db1 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Thu, 4 Aug 2022 14:05:12 +0200 Subject: [PATCH] Avoid unnecessary work --- which-key.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/which-key.el b/which-key.el index ba446a56737..529cceb40a1 100644 --- a/which-key.el +++ b/which-key.el @@ -1589,12 +1589,12 @@ If KEY contains any \"special keys\" defined in (defsubst which-key--truncate-description (desc) "Truncate DESC description to `which-key-max-description-length'." - (let* ((last-face (get-text-property (1- (length desc)) 'face desc)) - (dots (which-key--propertize which-key-ellipsis 'face last-face))) - (if (and which-key-max-description-length - (> (length desc) which-key-max-description-length)) - (concat (substring desc 0 which-key-max-description-length) dots) - desc))) + (if (and which-key-max-description-length + (> (length desc) which-key-max-description-length)) + (let* ((last-face (get-text-property (1- (length desc)) 'face desc)) + (dots (which-key--propertize which-key-ellipsis 'face last-face))) + (concat (substring desc 0 which-key-max-description-length) dots)) + desc)) (defun which-key--highlight-face (description) "Return the highlight face for DESCRIPTION if it has one." -- 2.30.2